$(function() {
		
		
		/* 加载全部数据 */
		$.ajax({
			type:"POST",
			url:"/ag/zrt/find_or_search_information.action",
			data:{searchArea:"all_area"},
			success:showData
		});
		
		/* 搜索 */
		$("#search").click(function(){
			$("#for_search").dialog("open");
		});
		
		/* 返回的排序方式 */
		var return_sort = $("#_sort").text();
		$("option[id="+return_sort+"]").attr("selected","selected");
		
		/* 加载类型 */	
		var select_url = "zrt/find_infortype.action";	
		$.post(select_url,function (data){
			$.each(data.inforTypeList,function(i,obj){
				$("<option value="+obj.itType+" id="+obj.itId+">"+obj.itType+"</option>").appendTo("#select_add");
				$("<option value="+obj.itType+" id="+obj.itId+">"+obj.itType+"</option>").appendTo("#select_modify");
				$("<option value="+obj.itType+" id="+obj.itId+">"+obj.itType+"</option>").appendTo("#search_type");
			});	
		});
		
		/* 排序触发器 */	
		$("#sortWay").change(function(){
			  
			var searchTitle = $("#search_title").val();
			// alert(searchTitle);
			var searchDate = $("#searchDate").val();
			// alert(searchDate);
			var searchType = $("#search_type option:selected").attr("id");
			// alert(searchType);
			var searchRatify = $("#search_ratify option:selected").attr("value");
			// alert(searchRatify);
			var searchRead = $("#search_read option:selected").attr("value");
			// alert(searchRead);
			var searchArea = $("#search_area option:selected").attr("id");
			// alert(searchArea);
			var sortWay = $("#sortWay option:selected").attr("id");
			// alert(sortWay);
			
			var req = {searchTitle:searchTitle,searchDate:searchDate,
					   searchType:searchType,searchRatify:searchRatify,
					   searchRead:searchRead,searchArea:searchArea,
					   sortWay:sortWay};
	
			$.ajax({
				type:"POST",
				url:"/ag/zrt/find_or_search_information.action",
				data:req,
				success: showData
			});
		});
		
		/* 清除增加框修改框上方错误提示 */
		$("input").change(function(){
			$(".validateTips").text("");
		});
		
		$("textarea").change(function(){
			$(".validateTips").text("");
		});
		
		/* 恢复增加类型框上方提示 */
		$("#newType").focus(function(){
			$("#type_warning").text("请输入新类型名称");
		});
		
		/* 添加新类型 */
		$(".typeAdd").click(function(){
			$("#add_newType").dialog('open');
		});
		
		/* 删除类型 */
		$(".typeDel").click(function(){
			var select = $(this).prev().prev();
			var typeReadyToDel = $(select).val();
			// alert(typeReadyToDel);
			$("#show_type").text(typeReadyToDel);
			$("#delete_type").dialog('open');
		});
		/* 取得当前排序方式，注意此语句所放位置 */
		var sortMark = $("#sortWay option:selected").attr("id");
		
		/* 首页 */
		$("#first_page").click(function(){	
			var searchTitle = $("#search_title").val();
			// alert(searchTitle);
			var searchDate = $("#searchDate").val();
			// alert(searchDate);
			var searchType = $("#search_type option:selected").attr("id");
			// alert(searchType);
			var searchRatify = $("#search_ratify option:selected").attr("value");
			// alert(searchRatify);
			var searchRead = $("#search_read option:selected").attr("value");
			// alert(searchRead);
			var searchArea = $("#search_area option:selected").attr("id");
			// alert(searchArea);
			var sortWay = $("#sortWay option:selected").attr("id");
		// alert(sortWay);
			
			var req = {searchTitle:searchTitle,searchDate:searchDate,
					   searchType:searchType,searchRatify:searchRatify,
					   searchRead:searchRead,searchArea:searchArea,
					   sortWay:sortWay};
			
			$.ajax({
				type:"POST",
				url:"/ag/zrt/find_or_search_information.action",
				data:req,
				success:showData
			});		
		});
		
		/* 尾页 */
		$("#last_page").click(function(){	
			var lastpage = $("#total_pages").text() - 1;
			// alert(lastpage);
				var searchTitle = $("#search_title").val();
				// alert(searchTitle);
				var searchDate = $("#searchDate").val();
				// alert(searchDate);
				var searchType = $("#search_type option:selected").attr("id");
				// alert(searchType);
				var searchRatify = $("#search_ratify option:selected").attr("value");
				// alert(searchRatify);
				var searchRead = $("#search_read option:selected").attr("value");
				// alert(searchRead);
				var searchArea = $("#search_area option:selected").attr("id");
				// alert(searchArea);
				var currentPage = lastpage;
				 // alert(currentPage);
				var sortWay = $("#sortWay option:selected").attr("id");
			// alert(sortWay);
				
				var req = {searchTitle:searchTitle,searchDate:searchDate,
						   searchType:searchType,searchRatify:searchRatify,
						   searchRead:searchRead,searchArea:searchArea,currentPage:currentPage,
						   sortWay:sortWay};
				
				$.ajax({
					type:"POST",
					url:"/ag/zrt/find_or_search_information.action",
					data:req,
					success:showData
				});		
			
		});
		
		/* 上一页 */
		$("#prev_page").click(function(){	
			var searchTitle = $("#search_title").val();
			// alert(searchTitle);
			var searchDate = $("#searchDate").val();
			// alert(searchDate);
			var searchType = $("#search_type option:selected").attr("id");
			// alert(searchType);
			var searchRatify = $("#search_ratify option:selected").attr("value");
			// alert(searchRatify);
			var searchRead = $("#search_read option:selected").attr("value");
			// alert(searchRead);
			var searchArea = $("#search_area option:selected").attr("id");
			// alert(searchArea);
			var currentPage = $("#current_page").text();
			// alert(currentPage);
			var sortWay = $("#sortWay option:selected").attr("id");
			// alert(sortWay);
			
			var req = {searchTitle:searchTitle,searchDate:searchDate,
					   searchType:searchType,searchRatify:searchRatify,
					   searchRead:searchRead,searchArea:searchArea,currentPage:currentPage,
					   sortWay:sortWay,nextOrPrev:0};
			
			$.ajax({
				type:"POST",
				url:"/ag/zrt/find_or_search_information.action",
				data:req,
				success:showData
			});					
		});
		
		/* 下一页 */
		$("#next_page").click(function(){
			var searchTitle = $("#search_title").val();
			// alert(searchTitle);
			var searchDate = $("#searchDate").val();
			// alert(searchDate);
			var searchType = $("#search_type option:selected").attr("id");
			// alert(searchType);
			var searchRatify = $("#search_ratify option:selected").attr("value");
			// alert(searchRatify);
			var searchRead = $("#search_read option:selected").attr("value");
			// alert(searchRead);
			var searchArea = $("#search_area option:selected").attr("id");
			// alert(searchArea);
			var currentPage = $("#current_page").text();
			// alert(currentPage);
			var sortWay = $("#sortWay option:selected").attr("id");
		// alert(sortWay);
			
			var req = {searchTitle:searchTitle,searchDate:searchDate,
					   searchType:searchType,searchRatify:searchRatify,
					   searchRead:searchRead,searchArea:searchArea,currentPage:currentPage,
					   sortWay:sortWay};
			
			$.ajax({
				type:"POST",
				url:"/ag/zrt/find_or_search_information.action",
				data:req,
				success:showData
			});		
		});
		
		/* 跳转页 */
		$("#jumpTo").click(function(){
			var inputPage = $("#inputPage").val() - 1;
			if(inputPage >= 0 && inputPage <= $("#total_pages").text()) {
				var searchTitle = $("#search_title").val();
				// alert(searchTitle);
				var searchDate = $("#searchDate").val();
				// alert(searchDate);
				var searchType = $("#search_type option:selected").attr("id");
				// alert(searchType);
				var searchRatify = $("#search_ratify option:selected").attr("value");
				// alert(searchRatify);
				var searchRead = $("#search_read option:selected").attr("value");
				// alert(searchRead);
				var searchArea = $("#search_area option:selected").attr("id");
				// alert(searchArea);
				var currentPage = inputPage;
				 // alert(currentPage);
				var sortWay = $("#sortWay option:selected").attr("id");
			// alert(sortWay);
				
				var req = {searchTitle:searchTitle,searchDate:searchDate,
						   searchType:searchType,searchRatify:searchRatify,
						   searchRead:searchRead,searchArea:searchArea,currentPage:currentPage,
						   sortWay:sortWay};
				
				alert("asdf");
				
				$.ajax({
					type:"POST",
					url:"/ag/zrt/find_or_search_information.action",
					data:req,
					success:showData
				});		
			}
			else {
				$("#operation_fail").dialog('open');
				$("#fail_msg").text("输入页码不合法,请得新输入");
				$("#fail_detail").text("页码过大或过小");
			}
		});
		
		
		
        /* 上方错误提示语句 */
		function updateTips(t) {
			tips
				.text(t)
				.addClass('ui-state-highlight');
			setTimeout(function() {
				tips.removeClass('ui-state-highlight', 1500);
			}, 500);
		}
		
		
		$("dialog").dialog("destory");
		
		/* 搜索框 */
		$("#for_search").click(function(){
					
						var searchTitle = $("#search_title").val();
						// alert(searchTitle);
						var searchDate = $("#search_date").val();
					// alert(searchDate);
						var searchType = $("#search_type option:selected").attr("id");
						// alert(searchType);
						var searchRatify = $("#search_ratify option:selected").attr("value");
						//alert(searchRatify);
						var searchRead = $("#search_read option:selected").attr("value");
						//alert(searchRead);
						var searchArea = $("#search_area option:selected").attr("id");
						// alert(searchArea);
			
						var req = {searchTitle:searchTitle,searchDate:searchDate,
								   searchType:searchType,searchRatify:searchRatify,
								   searchRead:searchRead,searchArea:searchArea};
						
						$.ajax({
							type:"POST",
							url:"/ag/zrt/find_or_search_information.action",
							data:req,
							success:showData
					});	
		});
		
		
		/* 增加记录框 */
		$("#dialog_add").dialog( {
			autoOpen : false,
			width : 500,
			modal : true,
			buttons : {
				'增加' : function() {		

			// alert($("select option:selected").attr("value"));
					var title_check = $.trim($("input[name='title_add']").val()).match(/[^x00-xff]/ig);
					(title_check == null ? 0:title_check.length);　　
					var detail_check = $.trim($("textarea[name='detail_add']").val()).match(/[^x00-xff]/ig);
					(detail_check == null ? 0:detail_check.length);　　
					// alert($.trim($("#select_add
					// option:selected").attr("value")));
					if(($.trim($("input[name='title_add']").val()).length+(title_check == null ? 0:title_check.length))>512)
					{
						updateTips("标题长度过长");
						$("input[name='title_add']").focus();
					}
					
					else if(($.trim($("textarea[name='detail_add']").val()).length+(detail_check == null ? 0:detail_check.length))>1024)
					{
						updateTips("正文长度过长，不超过512个汉字");
						$("textarea[name='detail_add']").focus();
					}
        											
					else if($.trim($("#select_add option:selected").text()) == '请选择') {
						updateTips("请选择一种类型");
						
					}
					
					else if($.trim($("input[name='title_add']").val()) != "" && $.trim($("textarea[name='detail_add']").val()) != "") {
						
						$("#dialog_add").dialog("close");
        				$("#add_confirm").dialog("open");
        			}
					
        			else{
        				updateTips("数据不可为空，请输入数据");
        				$("input[name='el_add']").focus();
        			}
				},
				'取消' : function() {
					$(this).dialog('close');
				}
			},
			close : function() {
				return false;
			}
		});
		
		/* 增加类型框 */
		$("#add_newType").dialog( {
			autoOpen : false,
			resizable: false,
			modal : true,
			buttons : {
				'确定' : function() {		

			// alert($("select option:selected").attr("value"));
					var type_check = $.trim($("#newType").val()).match(/[^x00-xff]/ig);
					(type_check == null ? 0:type_check.length);　　
					// alert($("#newType").val());
					if(($.trim($("#newType").val()).length+(type_check == null ? 0:type_check.length))>20)
					{
						$(".type_warning").text("类型长度过长，不超过10个汉字");
						// $("#newType").focus();
					}
        	
					else if($.trim($("#newType").val()) != "") {
						// alert("Ok!");
						var url_typeAdd = "zrt/add_infortype.action";
						var req_typeAdd = {'inforType.itType':$("#newType").val(),'inforType.a':1};
						
						$.post(url_typeAdd,req_typeAdd,function(data) {
							// alert(data.newInforTypeId);
							error_Detail = $.trim(data.errorDetail);
	        				if(error_Detail == "") {
	        					// alert(data.msg);
// $("span[id='succ_msg']").text(data.msg);
// $("#modify_confirm").dialog('close');
// $("#operation_succ").dialog('open');
	        					
	        					var nt = $("#newType").val();
								$("<option value="+$("#newType").val()+" id="+data.newInforTypeId+">"+$("#newType").val()+"</option>").appendTo("select");
								// $("#select_modify
								// option[text="+type+"]").attr("selected",
								// true);
								$("#select_add option[text="+nt+"]").attr("selected",true);
								$("#add_newType").dialog('close');
	        				}
	        				else {
	        			// alert(data.msg);
								$("span[id='fail_msg']").text(data.msg);
								$("#operation_fail").dialog('open');
	        				}
							
						});
        			}
        			else{
        				$(".type_warning").text("数据不可为空");
        			}
				},
				'取消' : function() {
					$(this).dialog('close');
				}
			},
			close : function() {
				return false;
			}
		});

		/* 修改记录框 */
		$("#dialog_modify").dialog( {
			autoOpen : false,
			// width : 500,
			modal : true,
			buttons : {
				'提交' : function() {
					var title_new = $.trim($("input[name='title_modify']").val()).match(/[^x00-xff]/ig);
					(title_new == null ? 0:title_new.length);　
					var detail_new = $.trim($("textarea[name='detail_modify']").val()).match(/[^x00-xff]/ig);
					(detail_new == null ? 0:detail_new.length);　
					if(($.trim($("input[name='title_modify']").val()).length+(title_new == null ? 0:title_new.length))>512)
					{
						updateTips("标题过长，不超过256个汉字");
						$("input[name='title_modify']").focus();
					}
					
					else if(($.trim($("textarea[name='detail_modify']").val()).length+(detail_new == null ? 0:detail_new.length))>1024)
					{
						updateTips("正文内容过长，不超过512个汉字");
						$("textarea[name='detail_modify']").focus();
					}
	     	
					else if($("input[name='title_modify']").val()==title && $("textarea[name='detail_modify']").val()==detail && 
							$("#select_modify option:selected").text() == type){
						    updateTips("数据未改变，请重新检查所输数据");
							$("input[name='el_modify']").focus();			
					}
					
					else if($("input[name='title_modify']").val()=="" || $("textarea[name='detail_modify']").val()=="" ){
						    updateTips("数据不可为空，请重新检查所输数据");
							$("input[name='el_modify']").focus();				
					}
					
					else if($.trim($("#select_modify option:selected").text()) == '请选择') {
						updateTips("请选择一种类型");
						
					}
						    						
					else {          
						$("#dialog_modify").dialog("close");
						$("#modify_confirm").dialog('open');						            			      				
					}
				},
				'取消' : function() {
					$(this).dialog('close');
				}
			},
			close : function() {
				$("dialog").dialog("close");
			}
		});
		
		/* 查看简报框 */
		$("#dialog_watch").dialog( {
			autoOpen : false,
			modal : true,
			buttons : {
			
				'发送' : function() {
						
						$("span[id='succ_msg']").text("发送成功");
						$("#dialog_watch").dialog('close');
						$("#operation_succ").dialog('open');
				},
			
				'通过' : function() {
					// location.href =
					// "/ag/zrt/find_information.action?currentPage="+keepPage+"&type="+$("#_type").text()+"&sortWay="+$("#_sort").text();
					var url = "zrt/verify_information.action?currentPage="+$("#current_page").text()+"&type="+$("#_type").text()+"&sortWay="+$("#_sort").text();
					var req = {'information.IId':id,'information.IState':2};
					$.post(url,req,function(data){
						error_Detail = $.trim(data.errorDetail);
        				if(error_Detail == "") {
        					$("span[id='succ_msg']").text(data.msg);
        					$("#modify_confirm").dialog('close');
        					$("#dialog_watch").dialog('close');
        					$("#operation_succ").dialog('open');
        				}
        				else {
							$("span[id='fail_msg']").text(data.msg);
							$("#operation_fail").dialog('open');
        				}
					});
				},
			
				'不通过' : function() {
					var url = "zrt/verify_information.action?currentPage="+$("#current_page").text()+"&type="+$("#_type").text()+"&sortWay="+$("#_sort").text();
					var req = {'information.IId':id,'information.IState':3};
					$.post(url,req,function(data){
						// $("#operation_succ").dialog("open");
						error_Detail = $.trim(data.errorDetail);
        				if(error_Detail == "") {
        				// alert(data.msg);
        					$("span[id='succ_msg']").text(data.msg);
        					$("#modify_confirm").dialog('close');
        					$("#dialog_watch").dialog('close');
        					$("#operation_succ").dialog('open');
        				}
        				else {
        				// alert(data.msg);
							$("span[id='fail_msg']").text(data.msg);
							$("#operation_fail").dialog('open');
        				}
					});
				},
				
				'待审' : function() {
					var url = "zrt/verify_information.action";
					var req = {'information.IId':id,'information.IState':1};
					$.post(url,req,function(data){
//						$("#dialog_watch").dialog('close');
//						$("#operation_succ").dialog("open");
						
						error_Detail = $.trim(data.errorDetail);
        				if(error_Detail == "") {
        				// alert(data.msg);
        					$("span[id='succ_msg']").text(data.msg);
        					$("#modify_confirm").dialog('close');
        					$("#dialog_watch").dialog('close');
        					$("#operation_succ").dialog('open');
        				}
        				else {
        				// alert(data.msg);
							$("span[id='fail_msg']").text(data.msg);
							$("#operation_fail").dialog('open');
        				}
					});
				},
			
				'修改' : function() {
					$(this).dialog('close');
					
					$("#dialog_modify").dialog("option","width","70%");
					$("input[name='title_modify']").val(title);
					$("#detail_modify").val(detail);
					$("#select_modify option[text="+type+"]").attr("selected", true); // 选中类择
					$('#dialog_modify').dialog('open');
				},
				
				'删除' : function() {
					$(this).dialog('close');
					$("#delete_confirm").dialog("open");
					
				},
				
				'返回' : function() {
					
						$(this).dialog('close');
					
				}
			},
			close : function() {
				return false;
			}
		});

		/* 修改记录确认 */
		$("#modify_confirm").dialog({
			autoOpen : false,
			resizable: false,
			modal: true,
			buttons: {
				'确定': function() {
							       	     						      		
        			var url_update = "zrt/update_information.action";
        			var new_title = $("input[name='title_modify']").val();
        			var new_detail = $("textarea[name='detail_modify']").val();
        			var new_typeId = $("#select_modify option:selected").attr("id");
        			var req = {'information.IId':id,'information.IInfo':new_title,'information.IDetial':new_detail,'information.tbInforType.itId':new_typeId};
        			$.post(url_update,req,function(data){
        				error_Detail = $.trim(data.errorDetail);
        				if(error_Detail == "") {
        				// alert(data.msg);
        					$("span[id='succ_msg']").text(data.msg);
        					$("#modify_confirm").dialog('close');
        					$("#operation_succ").dialog('open');
        				}
        				else {
        				// alert(data.msg);
							$("span[id='fail_msg']").text(data.msg);
							$("#operation_fail").dialog('open');
        				}
        				
        				// $("#operation_succ").dialog('open');
        			});            			      				
        	        		       	          	
				},
				'取消': function() {
					$(this).dialog('close');
				}
			}
		});

		/* 增加记录确认 */
		$("#add_confirm").dialog({
			autoOpen : false,
			resizable: false,
			modal: true,
			buttons: {
				'确定': function() {			
					
					var url = "zrt/add_information.action";
					var req = {'information.IInfo':$.trim($("input[name='title_add']").val()),
							    'information.IDetial':$.trim($("textarea[name='detail_add']").val()),
								'information.tbInforType.itId':$.trim($("#select_add option:selected").attr("id")),'information.IState':0,
								'information.a':1};
					$.post(url,req,function(data){
						// alert(data.msg);
						error_Detail = $.trim(data.errorDetail);
						if($.trim(data.errorDetail) == "") {
							// alert(data.msg);
							$("span[id='succ_msg']").text(data.msg);
							$("#add_confirm").dialog('close');
							$("#operation_succ").dialog('open');
						}
						/* 操作失败 */
						else {
							// alert(data.msg);
							$("span[id='fail_msg']").text(data.msg);						
							$("#operation_fail").dialog('open');
						}
					});				       	     						      		     		        			      				
        	        		       	          	
				},
				'取消': function() {
					$(this).dialog('close');
				}
			}
		});

		/* 删除记录框确认 */
		$("#delete_confirm").dialog({
			autoOpen : false,
			resizable: false,
			modal: true,
			buttons: {
				'确定': function() {			
							         	                     
	               var url="zrt/delete_information.action";
	               var req={id:id};
	               $.post(url,req,function(data){          	   
	            	   error_Detail = $.trim(data.errorDetail);
						if($.trim(data.errorDetail) == "") {
							// alert(data.msg);
							$("span[id='succ_msg']").text(data.msg);
							$("#delete_confirm").dialog('close');
							$("#operation_succ").dialog('open');
						}
						/* 操作失败 */
						else {
							// alert(data.msg);
							$("span[id='fail_msg']").text(data.msg);						
							$("#operation_fail").dialog('open');
						}
// $(this).dialog('close');
// $("#operation_succ").dialog('open');
	               });	               	                			      		     		        			      				       	        		       	          	
				},
				
				'取消': function() {
					$(this).dialog('close');
				}
			}
		});
		
		/* 删除类型框 */
		$("#delete_type").dialog( {
			autoOpen : false,
			resizable: false,
			modal : true,
			buttons : {
				'确定' : function() {		
						
							var url = "zrt/delete_infortype.action";
							var req = {'inforType.itId':$("select[id$=_add] option:selected").attr("id")};
							// alert(req);
							
							$.post(url,req,function(data){
								error_Detail = $.trim(data.errorDetail);
								if($.trim(data.errorDetail) == "") {
									// alert(data.msg);
									var deltype = $("select[id$=_add] option:selected").text();
									$("select[id$=_add] option:selected").remove();
									$("select[id$=_modify] option[text="+deltype+"]").remove();// 把修改框和搜索框里的类型相应的删除
									$("select[id$=_type] option[text="+deltype+"]").remove();
									$("#delete_type").dialog('close');
								}
								/* 操作失败 */
								else {
									// alert(data.msg);
									$("span[id='fail_msg']").text(data.msg);						
									$("#operation_fail").dialog('open');
								}							
							});
        			},
      
				'取消' : function() {
        					$(this).dialog('close');
        			}
				},
			close : function() {
				return false;
			}
		});

		/* 操作成功框 */
		$("#operation_succ").dialog({
			autoOpen : false,
			resizable: false,
			modal: true,
			buttons: {
				'确定': function() {
					// var num = $("#current_page").text() - 1;
					var searchTitle = $("#search_title").val();
					// alert(searchTitle);
					var searchDate = $("#search_date").val();
					// alert(searchDate);
					var searchType = $("#search_type option:selected").attr("id");
					// alert(searchType);
					var searchRatify = $("#search_ratify option:selected").attr("value");
					// alert(searchRatify);
					var searchRead = $("#search_read option:selected").attr("value");
					// alert(searchRead);
					var searchArea = $("#search_area option:selected").attr("id");
					// alert(searchArea);
		
					var req = {searchTitle:searchTitle,searchDate:searchDate,
							   searchType:searchType,searchRatify:searchRatify,
							   searchRead:searchRead,searchArea:searchArea};
					
					
					$.ajax({
						type:"POST",
						url:"/ag/zrt/find_or_search_information.action",
						data:req,
						success:showData
					});   	     
					
					$("#operation_succ").dialog("close");
					
				}
			}
		});
		
		/* 操作失败 框 */
		$("#operation_fail").dialog({
			autoOpen : false,
			resizable: false,
			modal: true,
			buttons: {
				'确定': function() {
					// $("button[name='增加']").attr("disabled","true");
					$("#operation_fail").dialog('close');
					$("#add_confirm").dialog("close");
					
					// location.href="/ag/zrt/find_event_level.action";
				},
				'详细':function(){
					$("span[id='fail_detail']").text(error_Detail);
					$("#operation_fail_detail").dialog('open');
				}
			},
			close:function(){
				$("#add_confirm").dialog("close");
				$("#modify_confirm").dialog("close");
				$("#delete_confirm").dialog("close");
			}
		});
		
		/* 操作失败之详细信息框 */
		$("#operation_fail_detail").dialog({
			autoOpen : false,
			resizable: false,
			modal: true,
			buttons: {
				'关闭': function() {
					$("#operation_fail_detail").dialog('close');						      		   	          	
				}			
			}
		});
		/* 打开增加框 */
		$("button[id='add']").click(function() {

			$("input[name='title_add']").val("");
			$("textarea[name='detail_add']").val("");
			$("#default").attr("selected",true);
			$('#dialog_add').dialog('option','width','700');
			// if($.browser.msie)
				// $('#dialog_add').dialog('option','height','100');
			// setTimeout("$('#dialog_add').dialog('open');",1000);
			 $('#dialog_add').dialog('open');
			 $("#title_add").focus();
		});
		/* 打开修改框 */
		$("button[class='modify']").click(function() {
			
			
			$('#dialog_add').dialog('option','width','700');
			if($.browser.msie)
				$('#dialog_add').dialog('option','height','100');
			$('#dialog_modify').dialog('open');
		});	
		/* 打开删除框 */
		$("button[class='delete']").click(function() {
			elId = $.trim($(this).parent().prev().prev().prev().prev().text());
			$('#delete_confirm').dialog('open');
		});	
		
		
		
		
				
		/* 加载按钮图片 */
		$("#add").mouseover(function(){
			$(this).css("background","url('/ag/images/add_info_mover.gif')");
		})
		.mouseout(function(){
			$(this).css("background","url('/ag/images/add_info_mout.gif')");
		})
		.mousedown(function(){
			$(this).css("background","url('/ag/images/add_info_mdown.gif')");
		})
		.mouseup(function(){
			$(this).css("background","url('/ag/images/add_info_mover.gif')");
		});

		/* 三种查看方式提标 */
		if(type == 'all') {
			$("#_all").css({"text-decoration":"underline","color":"red","font-style":"bold"});
		}
		if(type == 'history') {
			$("#_history").css({"text-decoration":"underline","color":"red","font-style":"bold"});
		}
		if(type == 'newInformation') {
			$("#_unread").css({"text-decoration":"underline","color":"red","font-style":"bold"});
		}
		
		function showData(data) {
			$("#informatinoQuery").empty();
			
			$("#current_page").text(data.currentPage);
			$("#total_information").text(data.all);
			$("#new_infos").text(data.newInfo);
			$("#total_pages").text(data.totalPage);
			
			$.each(data.infoList,function(i,info){
				fillToHtml(info.IId,info.IDate,info.IInfo,info.tbInforType.itType,info.IState,info.b)
			});
			
			/* 根据首尾页设置上下一页按钮的可视性 */
			
			if($("#current_page").text() == $("#total_pages").text() && $("#current_page").text() != 1) {
				//alert($("#current_page").text()+""+$("#total_pages").text());
				//alert("next none");
				$("#prev_page").show();
				$("#next_page").css("display","none");	
			}
			if($("#current_page").text() == 1 && $("#total_pages").text() == 1) {
				//alert("two none");
				$("#prev_page").css("display","none");
				$("#next_page").css("display","none");	
			}    
			if($("#current_page").text() == 1 && ($("#current_page").text() < $("#total_pages").text())) {     
				//alert("cool");
				$("#prev_page")./*show();*/css("display","none");
				$("#next_page").show();			
			}
			if($("#current_page").text() > 1 && ($("#current_page").text() < $("#total_pages").text())) {     
				//alert("cool");
				$("#prev_page").show();
				$("#next_page").show();			
			}
			
			
			/* 查看简报信息 */
			$("a[name='wacth']").click(function(){
				// alert(this.id);
				// alert ("watch");
				var url_watch = "zrt/watch_information.action";
				var req_watch = {id:$(this).attr("id")};
				// alert(req_watch.id);
				$.post(url_watch,req_watch,function(data){
					// alert(data.information.tbInforType.itType);
					/* 保存当前数据 */
					id = data.information.IId;
				// alert("asfds");
					title = data.information.IInfo;
					// alert(title);
					detail = data.information.IDetial;
					// alert(detail);
					type = data.information.tbInforType.itType;
					// alert(itId);
					status = data.information.b;
					$("#title_watch").text(data.information.IInfo);
					$("#date_watch").text(data.information.IDate);
					$("#detail_watch").text(data.information.IDetial);
					$("#type_watch").text(data.information.tbInforType.itType);	
					
					// $('#dialog_watch').dialog('option','width','70%');
					$('#dialog_watch').dialog('option','width','60%');
					$('#dialog_watch').dialog('open');
				});
				
			});
		}
		
		function fillToHtml(id,date,info,type,state,b) {
			
				// alert(info);
				
				var shtml = "<tr>";
				shtml += "<td>"+date+"</td>";
				shtml += "<td><a href='javascript:;' name='wacth' id="+id+" >"+info+"</a></td>";
				shtml += "<td>"+type+"</td>";
		
				if(state == 1)
					shtml += "<td>待审</td>";
				else if(state == 3)
					shtml += "<td>不通过</td>";
				else
					shtml += "<td>通过</td>";
		
				if(b == 0)
					shtml += "<td class='unread'>未读</td>";
				else
					shtml += "<td>已读</td>";
				
				shtml += "</tr>";
				$("#informatinoQuery").append(shtml);
		
				
		}
		
		/* 变色 */
		/*
		 * $("tr.list").mouseover(function() {
		 * $(this).children().css("background-color", "#66FFFF");
		 * }).mouseout(function() { $(this).children().css("background-color",
		 * "white"); });
		 */
	});